[SVM] Make sure that the WP bit is always set in CR0 when running SVM guests.
authorSteven Smith <ssmith@xensource.com>
Thu, 23 Nov 2006 09:36:48 +0000 (09:36 +0000)
committerSteven Smith <ssmith@xensource.com>
Thu, 23 Nov 2006 09:36:48 +0000 (09:36 +0000)
This is necessary to be sure that the shadow mode code can always detect
writes to guest page tables.

This should fix Windows restore from hibernation on SVM platforms.

Signed-off-by: Tom Woller <thomas.woller@amd.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/svm/vmcb.c

index 455bdac52e3f336d6ce01ddf1106596d02c78fce..f2a8659136de7fce5221df129921743eddaad082 100644 (file)
@@ -1441,7 +1441,7 @@ static int svm_set_cr0(unsigned long value)
     /* We don't want to lose PG.  ET is reserved and should be always be 1*/
     paging_enabled = svm_paging_enabled(v);
     value |= X86_CR0_ET;
-    vmcb->cr0 = value | X86_CR0_PG;
+    vmcb->cr0 = value | X86_CR0_PG | X86_CR0_WP;
     v->arch.hvm_svm.cpu_shadow_cr0 = value;
 
     /* TS cleared? Then initialise FPU now. */
@@ -2094,7 +2094,7 @@ static int svm_do_vmmcall_reset_to_realmode(struct vcpu *v,
     vmcb->tsc_offset = 0;
 
     /* VMCB State */
-    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG;
+    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG | X86_CR0_WP;
     v->arch.hvm_svm.cpu_shadow_cr0 = X86_CR0_ET;
 
     vmcb->cr2 = 0;
index fb246ae0ad88e87144423b731bcab4343233dae8..f00372440efe0b561307a95c507d7039d94d64b7 100644 (file)
@@ -197,6 +197,7 @@ static int construct_vmcb(struct vcpu *v)
     /* Guest CR0. */
     vmcb->cr0 = read_cr0();
     arch_svm->cpu_shadow_cr0 = vmcb->cr0 & ~(X86_CR0_PG | X86_CR0_TS);
+    vmcb->cr0 |= X86_CR0_WP;
 
     /* Guest CR4. */
     arch_svm->cpu_shadow_cr4 =